package cfca.paperless.client.servlet._3_assist._3_07_GetSealInfoList;

import cfca.paperless.client.servlet.PaperlessClient;
import cfca.paperless.client.servlet.PaperlessConfig;
import cfca.paperless.client.util.StringUtil;

/**
 * @Description testGetSealInfoList
 * @Author dell
 * @Date 2016-5-13
 * @CodeReviewer TODO
 */
public class GetSealInfoListTest01 {

    public static void main(String[] args) throws Exception {
        try {
            PaperlessClient clientBean = new PaperlessClient(PaperlessConfig.assistUrl, 10000, 60000);// 无纸化辅助接口的访问URL

            // 操作员编码或者机构号
            String operatorCode = PaperlessConfig.operatorCode;

            String requestXml = "<Request><OrgCode>CFCA0001</OrgCode>CFCA<OrgName></OrgName></Request>";
            String result = clientBean.getSealInfoList(requestXml, operatorCode);

            String code = StringUtil.getNodeText(result, "Code");
            if (!code.equals("200")) {
                System.out.println("OK:getSealInfoList");
                System.out.println(result);
            } else {
                Object[] sealInfoXmlArr = StringUtil.getXmlFieldArr(result, "SealInfoXml");
                System.out.println("sealInfoXmlArr.length:" + sealInfoXmlArr.length);
                for(Object sealInfoXmlObj:sealInfoXmlArr){
                    String sealInfoXml = sealInfoXmlObj.toString();
                    System.out.println(sealInfoXml);
                    System.out.println("SealCode:" + StringUtil.getNodeText(sealInfoXml, "SealCode"));
                    System.out.println("SealName:" + StringUtil.getNodeText(sealInfoXml, "SealName"));
                    System.out.println("SealPassword:" + StringUtil.getNodeText(sealInfoXml, "SealPassword"));
                    System.out.println("TellerCode:" + StringUtil.getNodeText(sealInfoXml, "TellerCode"));
                    System.out.println("OrgCode:" + StringUtil.getNodeText(sealInfoXml, "OrgCode"));
                    System.out.println("OrgName:" + StringUtil.getNodeText(sealInfoXml, "OrgName"));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
